#ifndef __TYPES_H__
#define __TYPES_H__


#include <iostream>
#include <memory>

enum ETrajectory
{
  ETrajectory0, // 0  < i <= T0
  ETrajectory1, // T0 < i <= T1
  ETrajectory2  // T1 < i <= T2
};

struct SDesired
{
  float Homography[2];
  float Derivative[2];
};

struct Pair
{
	int DistanceRowIndex;
	int IndexValue;

	Pair( int dist, int index )
	: DistanceRowIndex( dist )
	, IndexValue( index )
	{
	}
};


class CNullStream : public std::ostream
{
  public:
    CNullStream( ) : std::ostream( NULL )
    {
    }

    template <class T> std::ostream& operator<< (const T& t)
    {
      return *this;
    }
};

struct SResult
{
  private:
    bool IsOk;
    mutable std::auto_ptr<std::stringstream> pMessage;

  public:

    operator bool()
    {
      return IsOk;
    }

    void ResetBool()
    {
      IsOk = false;
    }

    std::ostream& SetResult( bool Result )
    {
      IsOk = Result;
      static CNullStream NullStream;

      if( Result )
      {
        return NullStream;
      }
      else
      {
        return *pMessage;
      }
    }

    std::string GetMessage( ) const
    {
      return pMessage->str( ).c_str( );
    }

    SResult( void )
    : IsOk( true )
    , pMessage( new std::stringstream )
    {
    };

    SResult( const SResult& Rhs )
    : IsOk( Rhs.IsOk )
    , pMessage( Rhs.pMessage )
    {
    }

    SResult& operator=( const SResult& Rhs )
    {
      IsOk = Rhs.IsOk;
      pMessage = Rhs.pMessage;
      return *this;
    }
};




#endif /* __TYPES_H__ */
